<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="main" />
        <title>Create Project</title>         
    </head>
    <body>
        <div class="nav">
	<span class="menuButton"><g:link class="home" controller="person" action="home">Home</g:link></span
            <span class="menuButton"><g:link class="list" action="list">Project List</g:link></span>
        </div>
        <div class="body">
            <h1>Create Project</h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${project}">
            <div class="errors">
                <g:renderErrors bean="${project}" as="list" />
            </div>
            </g:hasErrors>
            <g:form action="save" method="post" >
                <div class="dialog">
                    <table>
                        <tbody>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="group">Group:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:project,field:'group','errors')}">
                                    <g:select optionKey="id" from="${ProjectGroup.list()}" name="group.id" value="${params.projectGroupId}" noSelection="['':'-- Please Select --']"></g:select>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="projectCode">Project Code:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:project,field:'projectCode','errors')}">
                                    <input type="text" id="projectCode" name="projectCode" value="${fieldValue(bean:project,field:'projectCode')}"/>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="supervisor">Supervisor:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:project,field:'supervisor','errors')}">
                                    <g:select optionKey="id" from="${Person.supervisorList()}" name="supervisor.id" value="${session.user.id}" noSelection="['':'-- Please Select --']" ></g:select>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="projectName">Project Name:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:project,field:'projectName','errors')}">
                                    <input type="text" id="projectName" name="projectName" value="${fieldValue(bean:project,field:'projectName')}"/>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="description">Description:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:project,field:'description','errors')}">
                                    <textarea rows="5" cols="40" name="description">${fieldValue(bean:project, field:'description')}</textarea>
                                </td>
                            </tr> 
                        
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><input class="save" type="submit" value="Create" /></span>
                </div>

		<div class="paginateButtons">
		<input type="button" value="Back" onClick="history.back()">
                </div>
            </g:form>
        </div>
    </body>
</html>
